package com.agan.workflow.domain.vo;

import com.agan.common.core.utils.bean.BeanUtils;
import com.agan.workflow.domain.BpmType;

import java.util.List;
import java.util.stream.Collectors;


public class TreeSelect {

    private Long id;

    /** 节点名称 */
    private String label;


    private List<TreeSelect> children;

    public TreeSelect(BpmType bpmType) {
        this.id = bpmType.getTypeId();
        this.label = bpmType.getTypeName();
        if (BeanUtils.isNotEmpty(bpmType.getChildren())) {
            this.children = bpmType.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
        }
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public List<TreeSelect> getChildren() {
        return children;
    }

    public void setChildren(List<TreeSelect> children) {
        this.children = children;
    }
}
